package com.itheima.mybatis02.service;


import com.itheima.mybatis02.bean.Card;
import com.itheima.mybatis02.dao.CardMapper;
import com.itheima.mybatis02.dao.CardMapperTest;
import com.itheima.mybatis02.utils.MybatisUtils;
import org.apache.ibatis.session.SqlSession;
import org.junit.Test;

import java.util.List;

public class CardService implements CardServiceInterface{
    @Test
    public void selectAll(){
        SqlSession sqlSession = MybatisUtils.getSqlSession();
        CardMapper mapper = sqlSession.getMapper(CardMapper.class);
        List<Card> list = mapper.selectAll();
        System.out.println(list);
    }

    @Override
    public Card selectOnt(Integer id) {
        return null;
    }

    @Override
    public int update(Card card) {
        return 0;
    }

    @Override
    public int delete(Integer id) {
        return 0;
    }

    @Override
    public int insert(Card card) {
        return 0;
    }
    @Test
    public void selectAll2(){
        SqlSession sqlSession = MybatisUtils.getSqlSession();
        CardMapper mapper = sqlSession.getMapper(CardMapper.class);
        List<Card> cards = mapper.selectAll2();
        for (Card card : cards) {
            System.out.println(card);
        }
    }
    @Test
    public void selectAll3(){
        SqlSession sqlSession = MybatisUtils.getSqlSession();
        CardMapperTest mapper = sqlSession.getMapper(CardMapperTest.class);
        List<Card> cards = mapper.selectAll();
        for (Card card : cards) {
            System.out.println(card);
        }
    }
}
